﻿--
-- Dropping stored procedure pr_PhieuXuatKho_SelectAll : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuXuatKho_SelectAll]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuXuatKho_SelectAll]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuXuatKho_SelectAll
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:26 PM
-- Description:	This stored procedure is intended for selecting all rows from PhieuXuatKho table
-- ==========================================================================================
Create Procedure pr_PhieuXuatKho_SelectAll
As
Begin
	Select 
		[MaPhieuXuat],
		[KhoHang],
		[NgayPhieu],
		[MaNV]
	From PhieuXuatKho
End

GO


--
-- Dropping stored procedure pr_PhieuXuatKho_SelectRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuXuatKho_SelectRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuXuatKho_SelectRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuXuatKho_SelectRow
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:26 PM
-- Description:	This stored procedure is intended for selecting a specific row from PhieuXuatKho table
-- ==========================================================================================
Create Procedure pr_PhieuXuatKho_SelectRow
	@MaPhieuXuat varchar(10)
As
Begin
	Select 
		[MaPhieuXuat],
		[KhoHang],
		[NgayPhieu],
		[MaNV]
	From PhieuXuatKho
	Where
		[MaPhieuXuat] = @MaPhieuXuat
End

GO


--
-- Dropping stored procedure pr_PhieuXuatKho_Insert : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuXuatKho_Insert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuXuatKho_Insert]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuXuatKho_Insert
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:26 PM
-- Description:	This stored procedure is intended for inserting values to PhieuXuatKho table
-- ==========================================================================================
Create Procedure pr_PhieuXuatKho_Insert
	@MaPhieuXuat varchar(10),
	@KhoHang nvarchar(50),
	@NgayPhieu datetime,
	@MaNV varchar(10)
As
Begin
	Insert Into PhieuXuatKho
		([MaPhieuXuat],[KhoHang],[NgayPhieu],[MaNV])
	Values
		(@MaPhieuXuat,@KhoHang,@NgayPhieu,@MaNV)

End

GO


--
-- Dropping stored procedure pr_PhieuXuatKho_Update : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuXuatKho_Update]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuXuatKho_Update]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuXuatKho_Update
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:26 PM
-- Description:	This stored procedure is intended for updating PhieuXuatKho table
-- ==========================================================================================
Create Procedure pr_PhieuXuatKho_Update
	@MaPhieuXuat varchar(10),
	@KhoHang nvarchar(50),
	@NgayPhieu datetime,
	@MaNV varchar(10)
As
Begin
	Update PhieuXuatKho
	Set
		[KhoHang] = @KhoHang,
		[NgayPhieu] = @NgayPhieu,
		[MaNV] = @MaNV
	Where		
		[MaPhieuXuat] = @MaPhieuXuat

End

GO


--
-- Dropping stored procedure pr_PhieuXuatKho_DeleteRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuXuatKho_DeleteRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuXuatKho_DeleteRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuXuatKho_DeleteRow
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:26 PM
-- Description:	This stored procedure is intended for deleting a specific row from PhieuXuatKho table
-- ==========================================================================================
Create Procedure pr_PhieuXuatKho_DeleteRow
	@MaPhieuXuat varchar(10)
As
Begin
	Delete PhieuXuatKho
	Where
		[MaPhieuXuat] = @MaPhieuXuat

End

GO
